<meta charset="utf-8">
<div class="container">
		<ol class="breadcrumb">
		  <li><a href="#/project-list"><i class="fa fa-angel-right"></i> Proyectos</a></li>
		  <li class="active"><i class="fa fa-angel-right"></i> Crear proyecto</li>
		</ol>
		<div class="panel panel-default">
			<div class="panel-body">
				<h3>{{title}}</h3>
				<h4>Complete los siguientes pasos</h4>

				<!-- Nav tabs -->
				<ul class="nav nav-tabs" role="tablist">
				    <li role="presentation" ng-class="{'active': step == 1 }">
				    	<a href="javascript:void(0);" aria-controls="institutional" role="tab" data-toggle="tab" ng-click="changeStep(1)">Control de gestión</a>
				    </li>
				    <li role="presentation" ng-class="{'active': step == 2 }">
				    	<a href="javascript:void(0);" aria-controls="aspects" role="tab" data-toggle="tab" ng-click="changeStep(2)">Aspectos</a>
				    </li>
				    <li role="presentation" ng-class="{'active': step == 3 }">
				    	<a href="javascript:void(0);" aria-controls="forms" role="tab" data-toggle="tab" ng-click="changeStep(3)">Documentos legales</a>
				    </li>
				    <li role="presentation" ng-class="{'active': step == 4 }">
				    	<a href="javascript:void(0);" aria-controls="payments" role="tab" data-toggle="tab" ng-click="changeStep(4)">Contactos</a>
				    </li>
				    <li role="presentation" ng-class="{'active': step == 5 }">
				    	<a href="javascript:void(0);" aria-controls="payments" role="tab" data-toggle="tab" ng-click="changeStep(5)">Gestión de cobranzas</a>
				    </li>
				</ul>

				<!-- Tab panes -->
				<div class="tab-content">
				    <div role="tabpanel" class="tab-pane fade in active" id="institutional" ng-class="{'in active': step == 1 }">
				    	<form name="institutionalForm">
					    	<div class="row">
					    		<div class="col-sm-12">
					    			<h4>Información institucionales</h4>
					    		</div>
					    	</div>
					    	<div class="row mt20">
								<div class="col-sm-4">
									<div class="form-group">
										<div class="control-group">
											<label for="date-picker-2" class="control-label">Fecha de ingreso al INTI</label>
											<div class="controls">
												<div class="input-group">
													<input readonly id="date-picker-2" name="dateOfEntry" type="date" class="date-picker form-control" tabindex="1" required ng-model="project.dateOfEntry" />
													<label for="date-picker-2" class="input-group-addon btn">
													</label>
												</div>
											</div>
										</div>
									</div>
	
									<div class="form-group projectNumberInput">
										<label style="width: 100%;">Número de proyecto (formato: nnnnnn/aaaa)</label>
										<span> C.O. </span>
										<input readonly type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' maxlength="6"  class="form-control" placeholder="" tabindex="2" ng-model="project.numberId">
										<span> / </span>
										<input readonly type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' maxlength="4"  class="form-control" placeholder="" tabindex="2" ng-model="project.numberYear">
									</div>
								</div>
								<div class="col-sm-4">
									<div class="form-group">
										<label>Número de servicers</label>
										<div class="dropdown" tabindex="3" dropdown>
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.servicers == undefined">
										    	Elegir servicers
										    </span>
										    <span ng-show="project.servicers != undefined">
											    {{ project.servicers }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
									<div class="form-group">
										<label>Estado de situación</label>
										<div class="dropdown" tabindex="4" dropdown>
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.situationState == undefined">
										    	Elegir estado
										    </span>
										    <span ng-show="project.situationState != undefined">
											    {{ project.situationState }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
								</div>
								<div class="col-sm-4">
									<div class="form-group">
										<label>Evaluador segun services</label>
										<div class="dropdown" dropdown tabindex="5">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.evaluator == undefined">
										    	Elegir evaluador
										    </span>
										    <span ng-show="project.evaluator != undefined">
											    {{ project.evaluator.surname + ' ' + project.evaluator.name }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
									<div class="form-group">
										<label>Ascesor CAFESG</label>
										<div class="dropdown" dropdown tabindex="6">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.accesor == undefined">
										    	Elegir asesor
										    </span>
										    <span ng-show="project.accesor != undefined">
											    {{ project.accesor.surname + ' ' + project.accesor.name}} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
								</div>
	
							</div>
							<div class="row">
								<div class="col-sm-12">
									<div class="form-group">
										<label>Destino de la inversión</label>
										<textarea readonly   class="form-control" tabindex="7" placeholder="Ingrese el destino de la inversión" ng-model="project.investmentDestination"></textarea>
									</div>
								</div> 
							</div>
							<hr>
							<div class="row">
								<div class="col-sm-12">
									<div class="row head-small">
										<div class="col-sm-6">
											<h4>Titulares</h4>
										</div>
										<div class="col-sm-6 txtR">
										</div>	
									</div>
									<table class="table table-hover table-condensed table-responsive table-small">
									  <thead>
										<tr>
										  <th>
										  	<a href="javascript:void(0);">
										  		Nº
										  	</a>
										  </th>
										  <th>
										  	<a href="javascript:void(0);">
										  		Nombre
										  	</a>
										  </th>
										  <th class="txtC">Acciones</th>
										</tr>
									  </thead>
									  <tbody>
										<tr ng-repeat="holder in project.holders">
										  <td>{{holder.id}}</td>
										  <td>{{holder.surname + ' ' + holder.name}}</td>
										  <td class="txtC">
										  </td>
										</tr>
									  </tbody>
									</table>
								</div>						
							</div>
							<hr>
							<div class="row">
								<div class="col-sm-12">
									<div class="row head-small">
										<div class="col-sm-6">
											<h4>Codeudores</h4>
										</div>
										<div class="col-sm-6 txtR">
										</div>	
									</div>
									<table class="table table-hover table-condensed table-responsive table-small">
									  <thead>
										<tr>
										  <th>
										  	<a href="javascript:void(0);">
										  		Nº
										  	</a>
										  </th>
										  <th>
										  	<a href="javascript:void(0);">
										  		Nombre
										  	</a>
										  </th>
										  <th class="txtC">Acciones</th>
										</tr>
									  </thead>
									  <tbody>
										<tr ng-repeat="holder in project.guarantors">
										  <td>{{holder.id}}</td>
										  <td>{{holder.surname + ' ' + holder.name}}</td>
										  <td class="txtC">
										  </td>
										</tr>
									  </tbody>
									</table>
								</div>
							</div>
						</form>
					</div>
				    <div role="tabpanel" class="tab-pane fade" id="aspects" ng-class="{'in active': step == 2 }">
						<form name="aspectsForm">
							<div class="row">
								<div class="col-sm-12">
									<h4>Aspectos económicos</h4>
								</div>
							</div>
							<div class="row mt20">
								<div class="col-sm-4">
									<div class="form-group">
										<label>Titulo del proyecto</label> 
										<input readonly type="text" class="form-control" placeholder="Ingrese titulo del proyecto" tabindex="1" autofocus ng-model="project.title">
									</div>
									<div class="form-group">
										<label>Tipo de proyecto</label> 
										<div class="dropdown" dropdown tabindex="2">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.type == undefined">
										    	Elegir tipo
										    </span>
										    <span ng-show="project.type != undefined">
											    {{ project.type }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
								</div>
								<div class="col-sm-4">
									<div class="form-group">
										<label>Sector económico</label> 
										<div class="dropdown" dropdown is-open="status.isopen">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.economicArea == undefined">
										    	Elegir sector económico
										    </span>
										    <span ng-show="project.economicArea != undefined">
											    {{ project.economicArea }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
									<div class="form-group">
										<label>Actividad económica</label> 
										<div class="dropdown" dropdown is-open="status.isopen">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.economicActivity == undefined">
										    	Elegir actividad económica
										    </span>
										    <span ng-show="project.economicActivity != undefined">
											    {{ project.economicActivity }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
								</div>
								<div class="col-sm-4">
									<div class="form-group">
										<label>Rubro</label> 
										<div class="dropdown" dropdown is-open="status.isopen">
										  <a type="button" data-toggle="dropdown">
										    <span ng-show="project.category == undefined">
										    	Elegir rubro
										    </span>
										    <span ng-show="project.category != undefined">
											    {{ project.category }} 
										    </span>
										    <i class="fa fa-chevron-down"></i>
										  </a>
										</div>
									</div>
								</div>
							</div>
							<hr>
							<div class="row">
								<div class="col-sm-12">
									<h4>Aspectos financieros</h4>
								</div>
							</div>
							<div class="row mt20 withCurrency">
								<div class="col-sm-4" style="border-right: 1px solid #bebebe;">
									<div class="form-group">
										<label class="labelCurrency">Importe solicitado</label> 
										 <span class="input-group-addon adonPesos">$</span>
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control mediumInput" placeholder="Ingrese importe solicitado" tabindex="6" ng-model="project.requestedAmount"  >
									</div>
									<div class="form-group">
										<label>Periodo de gracia solicitado</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="Ingrese periodo de gracia solicitado" tabindex="8" ng-model="project.requestedGracePeriod"  >
									</div>
									<div class="form-group">
										<label>Plazo solicitado</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="Ingrese plazo solicitado" tabindex="7" ng-model="project.requestedDeadline"  >
									</div>
								</div>
								<div class="col-sm-4" style="border-right: 1px solid #bebebe;">
									<div class="form-group">
										<label class="labelCurrency">Importe otorgado</label> 
										<!-- pattern="(d{3})([.])(d{2})" ATENCION!!! CON ESTA VALIDACION NO FUNCIONA AL EDITAR EL PROYECTO -->
										 <span class="input-group-addon adonPesos">$</span>
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control mediumInput" placeholder="Ingrese importe otorgado" tabindex="10" ng-model="project.givenAmount"  >
									</div>
									<div class="form-group">
										<label>Periodo de gracia otorgado</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="Ingrese periodo de gracia otorgado" tabindex="8" ng-model="project.givenGracePeriod"  >
									</div>
									 <div class="form-group">
										<label>Plazo otorgado</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="Ingrese plazo otorgado" tabindex="11" ng-model="project.givenDeadline"  >
									</div>
								</div>
								<div class="col-sm-4">
									<div class="form-group">
										<div class="control-group">
											<label for="date-picker-2" class="control-label">Fecha de otorgamiento del crédito</label>
											<div class="controls">
												<div class="input-group">
													<input readonly id="date-picker-2" type="date" class="date-picker form-control" tabindex="9" ng-model="project.deliveryDate"/> 
													<label for="date-picker-2" class="input-group-addon btn">
													</label>
												</div>
											</div>
										</div>
									</div>
									 <div class="form-group">
										<label>Tasa original</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="0" tabindex="11" ng-model="project.originalRate"  >
									</div>
									 <div class="form-group">
										<label>Tasa vigente</label> 
										<input readonly type="number" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  class="form-control" placeholder="0" tabindex="11" ng-model="project.effectiveRate"  >
									</div>
								</div>
							</div>
						</form>
					</div>
				    <div role="tabpanel" class="tab-pane fade" id="forms" ng-class="{'in active': step == 3 }">
				    	<div class="row">
				    		<div class="col-sm-12">
				    			<h4>Checklist</h4>
				    		</div>
				    	</div>
				    	<div class="row mt20">
							<div class="col-sm-4">
								<h5>Aspectos generales</h5>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="1" ng-model="defaultForm1"> Formulario Completo
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="7" ng-model="defaultForm7"> DNI de titular y codeudores
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="8" ng-model="defaultForm8"> Comprobante de Domicilio de titular y codeudores
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="12" ng-model="defaultForm12"> Comprobantes de Sueldo de Co-deudores
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="5" ng-model="defaultForm5"> Visita CAFESG
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="3" ng-model="defaultForm3"> Contacto telefónico
									</label>
								</div>																																														
							</div>
							<div class="col-sm-4">
								<h5>Carpeta aprobada</h5>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="13" ng-model="defaultForm13"> Caratula
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="14" ng-model="defaultForm14"> Resumen del proyecto
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="18" ng-model="defaultForm18"> Carta de autorización
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="4" ng-model="defaultForm4"> Flujo de Fondos
									</label>
								</div>		
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="10" ng-model="defaultForm10"> Planilla de Co-Deudores
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="9" ng-model="defaultForm9"> Axesor y/o Veraz de titular y codeudores actualizado
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="2" ng-model="defaultForm2"> Pedido de más información
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="19" ng-model="defaultForm19"> Comprobantes de Sueldo de coodeudores actualizado
									</label>
								</div>
							</div>
							<div class="col-sm-4">
								<h5>Documentos Legales y/o Administrativos</h5>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="11" ng-model="defaultForm11"> Mutuos
									</label>
								</div>																				
								
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="15" ng-model="defaultForm15"> Fianzas

									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="16" ng-model="defaultForm16"> Pagares
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="6" ng-model="defaultForm6"> Orden de Pago
									</label>
								</div>
								<div class="form-group pos-rel">
									<label class="checkbox">
									  <input readonly type="checkbox" tabindex="17" ng-model="defaultForm17"> Cronograma de Pagos inicial
									</label>
								</div>
							</div>
						</div>
						<hr>
				    	<div class="row">
				    		<div class="col-sm-12">
				    			<h4>Documentos legales</h4>
				    		</div>
				    	</div>
						<div class="row">
							<div class="col-sm-12">
								<div class="row mt20" style="margin-bottom: 10px">
									<div class="col-sm-12 txtR">
										<button type="button" class="btn btn-primary" ng-click="loadForm()" ng-disabled="projectId == undefined">
											<i class="fa fa-file-text-o"></i> Generación de Documentación de Crédito
										</button>
									</div>	
								</div>
								<table class="table table-hover table-condensed table-responsive table-tiny">
								  <thead>
									<tr>
									  <th>
									  	Tipo
									  </th>
									  <th>
									  	Fecha de emisión
									  </th>
									  <th class="txtC">Acciones</th>
									</tr>
								  </thead>
								  <tbody>
									<tr ng-repeat="form in project.forms">
									  <td>{{form.formattedName}}</td>
									  <td>{{form.emitionDate | date:"dd/MM/yyyy"}}</td>
									  <td class="txtC">
										<button type="button" class="btn btn-link" ng-click="goToForm(form.name)"><i class="fa fa-pencil txtSuccess"></i></button>
									  </td>
									</tr>
								  </tbody>
								</table>
							<hr>
							<h4>Archivo</h4>
								<div style="margin-bottom: 10px;" class="row mt20">
									<div class="col-sm-12 txtR">
										<button type="button" class="btn btn-primary" ng-click="toggleAdditionalForm()">
											<i class="fa fa-file-text"></i> 
											<span ng-show="!additionalFormsVisible">Cargar formulario extra</span>
											<span ng-show="additionalFormsVisible">Finalizar Cargar de formulario extra</span>
										</button>
									</div>	
								</div>
								<table class="table table-hover table-condensed table-responsive table-tiny">
									<thead>
										<tr>
											<th>Archivo</th>
											<th class="txtC">Acciones</th>
										</tr>
									</thead>
									<tbody>
										<tr ng-repeat="addform in project.additionalForms">
											<td>{{addform.fileName}}</td>
											<td>
												<a href="{{pdfUrl(addform.fileName)}}" target="_blank">Vista Previa</a>
												<button type="button" class="btn btn-link" ng-click="">
													<i class="fa fa-trash txtDanger"></i>
												</button>
											</td>
										</tr>
									</tbody>
								</table>
								
								<div ng-show="additionalFormsVisible">
									<input readonly type="file" name="file" file-uploader on-success="onPdfUploadSuccess(fileName)" url="pdfUploadUrl()">
								</div>
								

							</div>						
						</div>
				    </div>
				    <div role="tabpanel" class="tab-pane fade" id="contacts" ng-class="{'in active': step == 4 }">
						<div class="row">
							<div class="col-sm-12">
								<div class="row head-small">
									<div class="col-sm-6">
										<h4>Contactos</h4>
									</div>
									<div class="col-sm-6 txtR">
										<button type="button" class="btn btn-primary" ng-click="addContact()">
											<i class="fa fa-plus-circle"></i> Cargar contacto
										</button>
									</div>	
								</div>
								<table class="table table-hover table-condensed table-responsive table-small">
								  <thead>
									<tr>
									  <th>
									  	<a href="javascript:void(0);">
									  		<!-- cambiar a fa-caret-up -->
									  		Fecha <i class="fa fa-caret-down pull-right"></i>
									  	</a>
									  </th>
									  <th>Observaciones</th>							  
									  <th class="txtC">Acciones</th>
									</tr>
								  </thead>
								  <tbody>
									<tr ng-repeat="contact in project.contacts">
									  <th>{{contact.dateFormatted}}</th>
									  <th>{{contact.comment}}</th>
									  <td class="txtC">
										<button type="button" class="btn btn-link" ng-click="editContact(contact)">
											<i class="fa fa-pencil txtDanger"></i>
										</button>
									  </td>
									</tr>
								  </tbody>
								</table>
							</div>						
						</div>


				    </div>
					<div role="tabpanel" class="tab-pane fade" id="payments" ng-class="{'in active': step == 5 }">
						<div class="row">
								<div class="col-sm-12">
									<div class="row head-small">
										<div class="col-sm-6">
											<h4>Últimos pagos</h4>
										</div>
										<div class="col-sm-6 txtR">
											<button type="button" class="btn btn-primary" ng-click="openPaymentModal()">
												<i class="fa fa-plus-circle"></i> Cargar pago
											</button>
											<button type="button" class="btn btn-primary" ng-click="goToPaymentCalendar()">
												<i class="fa fa-calendar-o"></i> Ver calendario de pagos
											</button>
											<!-- <button type="button" class="btn btn-primary" ng-click="goToScheduleCalendar()">
												<i class="fa fa-calendar-o"></i> Ver cronograma de pagos
											</button>-->
										</div>	
									</div>
									<table class="table table-hover table-condensed table-responsive table-payments">
									  <thead>
										<tr>
										  <th>
										  	<a href="javascript:void(0);">
										  		N°
										  	</a>
										  </th>
										  <th>Vencimientos</th>
										  <th>Monto cuota</th>
										  <th>Fecha de pago</th>
										  <th>Cobro</th>
										  <th class="txtC">Acciones</th>
										</tr>
									  </thead>
									  <tbody>
										<tr>
										  <td>1</td>
										  <th>01/01/2015</th>
										  <th>$1008,2</th>
										  <th>15/01/2015</th>
										  <th>$1010</th>
										  <td class="txtC">
											<button type="button" class="btn btn-link" onclick=""><i class="fa fa-eye txtSuccess" ></i></button>
											<button type="button" class="btn btn-link"><i class="fa fa-pencil txtDanger"></i></button>
										  </td>
										</tr>
										<tr>
										  <td>2</td>
										  <th>01/01/2015</th>
										  <th>$1008,2</th>
										  <th>15/01/2015</th>
										  <th>$1010</th>
										  <td class="txtC">
											<button type="button" class="btn btn-link" onclick=""><i class="fa fa-eye txtSuccess" ></i></button>
											<button type="button" class="btn btn-link"><i class="fa fa-pencil txtDanger"></i></button>
										  </td>
										</tr>
									  </tbody>
									</table>
								</div>						
							</div>
						</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-sm-12">
						<div class="pull-right">
							<div class="form-group">
								<button type="button" class="btn btn-primary" onclick="history.go(-1);">Volver</button>
								<span ng-show="!loadProjectButtonEnable && step  != 1 && step != 2">Debe primero guardar el proyecto desde la pestaña Control de Gestión o Aspectos</span>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>
	
